
import { lazy } from 'react'
import {Navigate } from "react-router-dom"

const Login = lazy(()=> import('../views/login/index'))
const Home = lazy(()=> import('../views/home/index'))
const QuestionAnsweringManagement = lazy(() => import('../views/questionAnsweringManagement/index'))
const Shopping = lazy(() => import('../views/shopping/index'))
const F404 = lazy(() => import('../views/404/index'))
const router = [
   {
      path: "/",
      element:<Navigate to="home" />,
   },
   {
      path: "/login",
      element: <Login />,
      meta:{
         title: '登录',
         isNav:true,
      }
   },
   {
      path: "/home",
      element: <Home />,
      meta:{
         title: '首页',
         isNav:false,
      }
   },
   {
      path: "/questionAnsweringManagement",
      element: <QuestionAnsweringManagement />,
      loader:()=>(document.title = '问答管理'),
      meta:{
         title: '问答管理',
         isNav:false,
      }
   },
   {
      path: "/shopping",
      element: <Shopping />,
      meta:{
         title: '商城',
         isNav:true,
      }
   },
   {
      path: "*",
      element: <F404 />,
      meta:{
         title: 'F404',
         isNav:true,
      }
   },
]

export default router